#ifndef _GLOBAL_H
#define _GLOBAL_H

#include <jni.h>
#include <android/log.h>

#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>

#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <sys/time.h>
#include <stdbool.h>

#include <android/log.h>

#ifdef __cplusplus
extern "C" {
#endif

#define TAG "VideoController"
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__)
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__)
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__)

#define PROC_BEGIN do {
#define PROC_END } while (0);

typedef struct _buffer_data {
	unsigned char *buf;
	int len;
	int width;
	int height;
} buffer_data_t;

extern uint8_t *g_vedio_buffer;
extern size_t g_vedio_buffer_size;
extern int g_width;
extern int g_height;
extern int g_format;
extern int g_fps;
extern uint8_t *g_audio_buffer;
extern size_t g_audio_buffer_size;

extern JavaVM *g_jvm;
extern jclass g_render_cls;
extern jobject g_render_obj;
extern jmethodID g_render_mid;

void printLog(GLuint obj);
char *file2string(const char *path);
void printGLString(const char *name, GLenum s);
void checkGlError(const char* op);

#ifdef __cplusplus
}
#endif
#endif

